package bean.application;

import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.Map;

import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;

import entity.Measure;
import entity.Operation;
import entity.SocialNetwork;
import entity.State;
import entity.Status;
import entity.UserType;

@ManagedBean(name="utila")
@ApplicationScoped
public class Util implements Serializable {
	private static final long serialVersionUID = 9032007235036864041L;
	
	private Map<String, Object> accountsType;
	private Map<String, Object> genders;
	private Map<String, Object> measures;
	private Map<String, Object> states;
	private Map<String, Object> status;
	private Map<String, Object> socialNetworks;
	private Map<String, Object> operations;

	
	public Map<String, Object> socialNetworks() {
		socialNetworks = new LinkedHashMap<String, Object>();
		socialNetworks.put("Rede Social:", "");
		socialNetworks.put("Facebook", new SocialNetwork(new Integer(1), "Facebook"));
		socialNetworks.put("Google+", new SocialNetwork(new Integer(2), "Google+"));
		socialNetworks.put("Link", new SocialNetwork(new Integer(3), "Link"));
		socialNetworks.put("Twitter", new SocialNetwork(new Integer(4), "Twitter"));
		socialNetworks.put("Website", new SocialNetwork(new Integer(5), "Websute"));

		return socialNetworks;
	}
	
	public Map<String, Object> getStatus() {
		
		status = new LinkedHashMap<String, Object>();
		status.put("Você precisa ou fornece:", "");
		status.put("Inativo", new Status(new Integer(1), "inativo"));
		status.put("Preciso", new Status(new Integer(2), "preciso"));
		status.put("Forneço", new Status(new Integer(3), "forneço"));
		
		return status;
	}
	
	public Map<String, Object> getStates() {

		states = new LinkedHashMap<String, Object>();

		states.put("Selecione um estado:", "");

//			for (State s : list){
//				System.out.println("states.put(\""+ s.getState()+ "\", new State(new Integer(" + s.getId() + "), \"" + s.getState() + "\" ));" );
		states.put("Acre", new State(new Integer(1), "Acre" ));
		states.put("Alagoas", new State(new Integer(2), "Alagoas" ));
		states.put("Amapá", new State(new Integer(4), "Amapá" ));
		states.put("Amazonas", new State(new Integer(3), "Amazonas" ));
		states.put("Bahia", new State(new Integer(5), "Bahia" ));
		states.put("Ceará", new State(new Integer(6), "Ceará" ));
		states.put("Distrito Federal", new State(new Integer(7), "Distrito Federal" ));
		states.put("Espírito Santo", new State(new Integer(8), "Espírito Santo" ));
		states.put("Goiás", new State(new Integer(9), "Goiás" ));
		states.put("Maranhão", new State(new Integer(10), "Maranhão" ));
		states.put("Mato Grosso", new State(new Integer(13), "Mato Grosso" ));
		states.put("Mato Grosso do Sul", new State(new Integer(12), "Mato Grosso do Sul" ));
		states.put("Minas Gerais", new State(new Integer(11), "Minas Gerais" ));
		states.put("Pará", new State(new Integer(14), "Pará" ));
		states.put("Paraíba", new State(new Integer(15), "Paraíba" ));
		states.put("Paraná", new State(new Integer(18), "Paraná" ));
		states.put("Pernambuco", new State(new Integer(16), "Pernambuco" ));
		states.put("Piauí", new State(new Integer(17), "Piauí" ));
		states.put("Rio de Janeiro", new State(new Integer(19), "Rio de Janeiro" ));
		states.put("Rio Grande do Norte", new State(new Integer(20), "Rio Grande do Norte" ));
		states.put("Rio Grande do Sul", new State(new Integer(23), "Rio Grande do Sul" ));
		states.put("Rondônia", new State(new Integer(21), "Rondônia" ));
		states.put("Roraima", new State(new Integer(22), "Roraima" ));
		states.put("Santa Catarina", new State(new Integer(24), "Santa Catarina" ));
		states.put("São Paulo", new State(new Integer(25), "São Paulo" ));
		states.put("Sergipe", new State(new Integer(26), "Sergipe" ));
		states.put("Tocantins", new State(new Integer(27), "Tocantins" ));

		//			}

		return states;
	}
	
	public Map<String, Object> getAccountsType() {
		accountsType = new LinkedHashMap<String, Object>();
		accountsType.put("Selecione seu tipo de conta:", "");
		accountsType.put("Pessoa", new UserType(70, "pessoa"));

		return accountsType;
	}

	public Map<String, Object> getGenders() {
		genders = new LinkedHashMap<String, Object>();
		genders.put("Eu sou:", "");
		genders.put("Masculino", "M"); // label, value
		genders.put("Feminino", "F");

		return genders;
	}
	
	public Map<String, Object> getOperations() {
		operations = new LinkedHashMap<String, Object>();
		operations.put("Selecione um tipo de operação:", "");
		operations.put("Doação", new Operation(new Integer(1), "doação"));
		operations.put("Troca", new Operation(new Integer(2), "troca"));
		
		return operations;
	}
	
	public Map<String, Object> getMeasures() {
		measures = new LinkedHashMap<String, Object>();
		measures.put("Selecione uma medida:", "");
		measures.put("Quilograma", new Measure(new Integer(1), "quilograma"));
		measures.put("Litro", new Measure(new Integer(2), "litro"));
		measures.put("Metro", new Measure(new Integer(3), "metro"));
		measures.put("Unidade", new Measure(new Integer(4), "unidade"));

		return measures;

	}

	public void setAccountsType(Map<String, Object> accountsType) {
		this.accountsType = accountsType;
	}
	
	public void setGenders(Map<String, Object> genders) {
		this.genders = genders;
	}

	public void setMeasures(Map<String, Object> measures) {
		this.measures = measures;
	}

	public void setStates(Map<String, Object> states) {
		this.states = states;
	}

	public void setOperations(Map<String, Object> operations) {
		this.operations = operations;
	}

	public void setStatus(Map<String, Object> status) {
		this.status = status;
	}

	public Map<String, Object> getSocialNetworks() {
		return socialNetworks;
	}

	public void setSocialNetworks(Map<String, Object> socialNetworks) {
		this.socialNetworks = socialNetworks;
	}
	
	

}
